package org.example.test.event;

import org.junit.jupiter.api.Test;

import javax.swing.*;

/**
 * @author cc
 * @date 2021/4/17 12:45
 * @Description 小球通过键盘上下左右移动
 */

public class Ballmove extends JFrame {
    MyPanelTest myPanelTest=null;
    @Test
  public void test(){
        Ballmove ballmove = new Ballmove();
    }
  public Ballmove(){
      myPanelTest = new MyPanelTest();
      this.add(myPanelTest);
      this.setSize(400,300);
      //监听事件
      this.addKeyListener(myPanelTest);
      this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      this.setVisible(true);
  }
}
